$(function() {
	FastClick.attach(document.body);
	setFullScreen(".supervise-condition", 20)
});

var detailConditionVue = new Vue({
	el: "body",
	data: {
		detailCondition: "",
		index: "",
		taskId: ""
	},
	created: function() {
		_this = this
		_this.index = parseInt(getUrlItem("index"));
		_this.taskId = getUrlItem("TASKID");
		$.getJSON("http://47.92.116.158:8099/BhGgjAPI/Supervise.asmx/getTaskTimelag?callback=?&taskid=" + _this.taskId, function(jsondata) {
			_this.detailCondition = jsondata[_this.index]
		})

		_this.$nextTick(function() {
			setTimeout(function() {
				$(".supervise-condition").removeClass("hidden")
				$(".loader").addClass("hidden")
			}, 200)
		})

	},
	methods: {

	}

})

/**
 * 
 * @param {Object} Name   需要设置充满屏幕的对象
 * @param {Object} Height 预留空间
 */
function setFullScreen(Name, Height) {
	$(document).ready(function() { //DOM加载后就执行
		var WindowHeight = $(window).height();
		$(Name).css('height', WindowHeight - Height);
	});
	$(window).resize(function() { //改变窗体大小时     *resize()变化或者改变事件
		var WindowHeight = $(window).height();
		$(Name).css('height', WindowHeight - Height);
	});
	$(window).scroll(function() { //浏览器有滚动条时的操作   scroll()滚动事件
		var WindowHeight = $(window).height();
		$(Name).css('height', WindowHeight - Height);
	});
}

function getUrlItem(name) { //id
	var url = location.search
	start = url.indexOf(name + "=")
	if(start != -1) {
		start = start + name.length + 1
		end = url.indexOf("&", start)
		if(end == -1) {
			end = url.length
			return unescape(url.substring(start, end))
		}
		return unescape(url.substring(start, end))
	}
	return '';
}